package net.airtheva.weather;

import java.util.ArrayList;
import java.util.HashMap;

public class Constants {

	public static final HashMap<String, Integer> LocationCodes;
	public static final ArrayList<String> LocationNames;
	
	public static final HashMap<String, Integer> WeatherCodes;
	public static final ArrayList<String> WeatherNames;
	
	static {
		
		LocationCodes = new HashMap<String, Integer>();
		LocationNames = new ArrayList<String>();
		
		WeatherCodes = new HashMap<String, Integer>();
		WeatherNames = new ArrayList<String>();
		
		// Adapted from https://github.com/sofish/weather-api.
		
	    LocationCodes.put("北京", 101010100);
	    LocationCodes.put("重庆", 101040100);
	    LocationCodes.put("上海", 101020100);
	    LocationCodes.put("天津", 101030100);
	    LocationCodes.put("澳门", 101330101);
	    LocationCodes.put("香港", 101320101);
	    LocationCodes.put("合肥", 101220101);
	    LocationCodes.put("蚌埠", 101220201);
	    LocationCodes.put("芜湖", 101220301);
	    LocationCodes.put("淮南", 101220401);
	    LocationCodes.put("马鞍山", 101220501);
	    LocationCodes.put("安庆", 101220601);
	    LocationCodes.put("宿州", 101220701);
	    LocationCodes.put("阜阳", 101220801);
	    LocationCodes.put("亳州", 101220901);
	    LocationCodes.put("黄山", 101221001);
	    LocationCodes.put("滁州", 101221101);
	    LocationCodes.put("淮北", 101221201);
	    LocationCodes.put("铜陵", 101221301);
	    LocationCodes.put("宣城", 101221401);
	    LocationCodes.put("六安", 101221501);
	    LocationCodes.put("巢湖", 101221601);
	    LocationCodes.put("池州", 101221701);
	    LocationCodes.put("福州", 101230101);
	    LocationCodes.put("厦门", 101230201);
	    LocationCodes.put("宁德", 101230301);
	    LocationCodes.put("莆田", 101230401);
	    LocationCodes.put("泉州", 101230501);
	    LocationCodes.put("漳州", 101230601);
	    LocationCodes.put("龙岩", 101230701);
	    LocationCodes.put("三明", 101230801);
	    LocationCodes.put("南平", 101230901);
	    LocationCodes.put("兰州", 101160101);
	    LocationCodes.put("定西", 101160201);
	    LocationCodes.put("平凉", 101160301);
	    LocationCodes.put("庆阳", 101160401);
	    LocationCodes.put("武威", 101160501);
	    LocationCodes.put("金昌", 101160601);
	    LocationCodes.put("张掖", 101160701);
	    LocationCodes.put("酒泉", 101160801);
	    LocationCodes.put("天水", 101160901);
	    LocationCodes.put("武都", 101161001);
	    LocationCodes.put("临夏", 101161101);
	    LocationCodes.put("合作", 101161201);
	    LocationCodes.put("白银", 101161301);
	    LocationCodes.put("广州", 101280101);
	    LocationCodes.put("韶关", 101280201);
	    LocationCodes.put("惠州", 101280301);
	    LocationCodes.put("梅州", 101280401);
	    LocationCodes.put("汕头", 101280501);
	    LocationCodes.put("深圳", 101280601);
	    LocationCodes.put("珠海", 101280701);
	    LocationCodes.put("佛山", 101280800);
	    LocationCodes.put("肇庆", 101280901);
	    LocationCodes.put("湛江", 101281001);
	    LocationCodes.put("江门", 101281101);
	    LocationCodes.put("河源", 101281201);
	    LocationCodes.put("清远", 101281301);
	    LocationCodes.put("云浮", 101281401);
	    LocationCodes.put("潮州", 101281501);
	    LocationCodes.put("东莞", 101281601);
	    LocationCodes.put("中山", 101281701);
	    LocationCodes.put("阳江", 101281801);
	    LocationCodes.put("揭阳", 101281901);
	    LocationCodes.put("茂名", 101282001);
	    LocationCodes.put("汕尾", 101282101);
	    LocationCodes.put("东沙岛", 101282105);
	    LocationCodes.put("南宁", 101300101);
	    LocationCodes.put("崇左", 101300201);
	    LocationCodes.put("柳州", 101300301);
	    LocationCodes.put("来宾", 101300401);
	    LocationCodes.put("桂林", 101300501);
	    LocationCodes.put("梧州", 101300601);
	    LocationCodes.put("贺州", 101300701);
	    LocationCodes.put("贵港", 101300801);
	    LocationCodes.put("玉林", 101300901);
	    LocationCodes.put("百色", 101301001);
	    LocationCodes.put("钦州", 101301101);
	    LocationCodes.put("河池", 101301201);
	    LocationCodes.put("北海", 101301301);
	    LocationCodes.put("防城港", 101301401);
	    LocationCodes.put("贵阳", 101260101);
	    LocationCodes.put("遵义", 101260201);
	    LocationCodes.put("安顺", 101260301);
	    LocationCodes.put("都匀", 101260401);
	    LocationCodes.put("凯里", 101260501);
	    LocationCodes.put("铜仁", 101260601);
	    LocationCodes.put("毕节", 101260701);
	    LocationCodes.put("六盘水", 101260801);
	    LocationCodes.put("黔西", 101260901);
	    LocationCodes.put("海口", 101310101);
	    LocationCodes.put("琼山", 101310102);
	    LocationCodes.put("三亚", 101310201);
	    LocationCodes.put("东方", 101310202);
	    LocationCodes.put("临高", 101310203);
	    LocationCodes.put("澄迈", 101310204);
	    LocationCodes.put("儋州", 101310205);
	    LocationCodes.put("昌江", 101310206);
	    LocationCodes.put("白沙", 101310207);
	    LocationCodes.put("琼中", 101310208);
	    LocationCodes.put("定安", 101310209);
	    LocationCodes.put("屯昌", 101310210);
	    LocationCodes.put("琼海", 101310211);
	    LocationCodes.put("文昌", 101310212);
	    LocationCodes.put("清兰", 101310213);
	    LocationCodes.put("保亭", 101310214);
	    LocationCodes.put("万宁", 101310215);
	    LocationCodes.put("陵水", 101310216);
	    LocationCodes.put("西沙", 101310217);
	    LocationCodes.put("珊瑚岛", 101310218);
	    LocationCodes.put("永署礁", 101310219);
	    LocationCodes.put("南沙岛", 101310220);
	    LocationCodes.put("乐东", 101310221);
	    LocationCodes.put("通什", 101310222);
	    LocationCodes.put("石家庄", 101090101);
	    LocationCodes.put("保定", 101090201);
	    LocationCodes.put("张家口", 101090301);
	    LocationCodes.put("承德市", 101090401);
	    LocationCodes.put("唐山", 101090501);
	    LocationCodes.put("廊坊", 101090601);
	    LocationCodes.put("沧州", 101090701);
	    LocationCodes.put("衡水", 101090801);
	    LocationCodes.put("邢台", 101090901);
	    LocationCodes.put("邯郸", 101091001);
	    LocationCodes.put("秦皇岛", 101091101);
	    LocationCodes.put("郑州", 101180101);
	    LocationCodes.put("安阳", 101180201);
	    LocationCodes.put("新乡", 101180301);
	    LocationCodes.put("许昌", 101180401);
	    LocationCodes.put("平顶山", 101180501);
	    LocationCodes.put("信阳", 101180601);
	    LocationCodes.put("南阳", 101180701);
	    LocationCodes.put("开封", 101180801);
	    LocationCodes.put("洛阳", 101180901);
	    LocationCodes.put("商丘", 101181001);
	    LocationCodes.put("焦作", 101181101);
	    LocationCodes.put("鹤壁", 101181201);
	    LocationCodes.put("濮阳", 101181301);
	    LocationCodes.put("周口", 101181401);
	    LocationCodes.put("漯河", 101181501);
	    LocationCodes.put("驻马店", 101181601);
	    LocationCodes.put("三门峡", 101181701);
	    LocationCodes.put("济源", 101181801);
	    LocationCodes.put("哈尔滨", 101050101);
	    LocationCodes.put("齐齐哈尔", 101050201);
	    LocationCodes.put("牡丹江", 101050301);
	    LocationCodes.put("佳木斯", 101050401);
	    LocationCodes.put("绥化", 101050501);
	    LocationCodes.put("黑河", 101050601);
	    LocationCodes.put("大兴安岭", 101050701);
	    LocationCodes.put("伊春", 101050801);
	    LocationCodes.put("大庆", 101050901);
	    LocationCodes.put("七台河", 101051002);
	    LocationCodes.put("鸡西", 101051101);
	    LocationCodes.put("鹤岗", 101051201);
	    LocationCodes.put("双鸭山", 101051301);
	    LocationCodes.put("武汉", 101200101);
	    LocationCodes.put("襄樊", 101200201);
	    LocationCodes.put("鄂州", 101200301);
	    LocationCodes.put("孝感", 101200401);
	    LocationCodes.put("黄冈", 101200501);
	    LocationCodes.put("黄石", 101200601);
	    LocationCodes.put("咸宁", 101200701);
	    LocationCodes.put("荆州", 101200801);
	    LocationCodes.put("宜昌", 101200901);
	    LocationCodes.put("恩施", 101201001);
	    LocationCodes.put("十堰", 101201101);
	    LocationCodes.put("神农架", 101201201);
	    LocationCodes.put("随州", 101201301);
	    LocationCodes.put("荆门", 101201401);
	    LocationCodes.put("天门", 101201501);
	    LocationCodes.put("仙桃", 101201601);
	    LocationCodes.put("潜江", 101201701);
	    LocationCodes.put("长沙", 101250101);
	    LocationCodes.put("湘潭", 101250201);
	    LocationCodes.put("株洲", 101250301);
	    LocationCodes.put("衡阳", 101250401);
	    LocationCodes.put("郴州", 101250501);
	    LocationCodes.put("常德", 101250601);
	    LocationCodes.put("益阳", 101250701);
	    LocationCodes.put("娄底", 101250801);
	    LocationCodes.put("邵阳", 101250901);
	    LocationCodes.put("岳阳", 101251001);
	    LocationCodes.put("张家界", 101251101);
	    LocationCodes.put("怀化", 101251201);
	    LocationCodes.put("黔阳", 101251301);
	    LocationCodes.put("永州", 101251401);
	    LocationCodes.put("吉首", 101251501);
	    LocationCodes.put("长春", 101060101);
	    LocationCodes.put("吉林", 101060201);
	    LocationCodes.put("延吉", 101060301);
	    LocationCodes.put("四平", 101060401);
	    LocationCodes.put("通化", 101060501);
	    LocationCodes.put("白城", 101060601);
	    LocationCodes.put("辽源", 101060701);
	    LocationCodes.put("松原", 101060801);
	    LocationCodes.put("白山", 101060901);
	    LocationCodes.put("南京", 101190101);
	    LocationCodes.put("无锡", 101190201);
	    LocationCodes.put("镇江", 101190301);
	    LocationCodes.put("苏州", 101190401);
	    LocationCodes.put("南通", 101190501);
	    LocationCodes.put("扬州", 101190601);
	    LocationCodes.put("盐城", 101190701);
	    LocationCodes.put("徐州", 101190801);
	    LocationCodes.put("淮安", 101190901);
	    LocationCodes.put("连云港", 101191001);
	    LocationCodes.put("常州", 101191101);
	    LocationCodes.put("泰州", 101191201);
	    LocationCodes.put("宿迁", 101191301);
	    LocationCodes.put("南昌", 101240101);
	    LocationCodes.put("九江", 101240201);
	    LocationCodes.put("上饶", 101240301);
	    LocationCodes.put("抚州", 101240401);
	    LocationCodes.put("宜春", 101240501);
	    LocationCodes.put("吉安", 101240601);
	    LocationCodes.put("赣州", 101240701);
	    LocationCodes.put("景德镇", 101240801);
	    LocationCodes.put("萍乡", 101240901);
	    LocationCodes.put("新余", 101241001);
	    LocationCodes.put("鹰潭", 101241101);
	    LocationCodes.put("沈阳", 101070101);
	    LocationCodes.put("大连", 101070201);
	    LocationCodes.put("鞍山", 101070301);
	    LocationCodes.put("抚顺", 101070401);
	    LocationCodes.put("本溪", 101070501);
	    LocationCodes.put("丹东", 101070601);
	    LocationCodes.put("锦州", 101070701);
	    LocationCodes.put("营口", 101070801);
	    LocationCodes.put("阜新", 101070901);
	    LocationCodes.put("辽阳", 101071001);
	    LocationCodes.put("铁岭", 101071101);
	    LocationCodes.put("朝阳", 101071201);
	    LocationCodes.put("盘锦", 101071301);
	    LocationCodes.put("葫芦岛", 101071401);
	    LocationCodes.put("呼和浩特", 101080101);
	    LocationCodes.put("包头", 101080201);
	    LocationCodes.put("乌海", 101080301);
	    LocationCodes.put("集宁", 101080401);
	    LocationCodes.put("通辽", 101080501);
	    LocationCodes.put("赤峰", 101080601);
	    LocationCodes.put("鄂尔多斯", 101080701);
	    LocationCodes.put("临河", 101080801);
	    LocationCodes.put("锡林浩特", 101080901);
	    LocationCodes.put("呼伦贝尔", 101081000);
	    LocationCodes.put("乌兰浩特", 101081101);
	    LocationCodes.put("阿拉善左旗", 101081201);
	    LocationCodes.put("银川", 101170101);
	    LocationCodes.put("石嘴山", 101170201);
	    LocationCodes.put("吴忠", 101170301);
	    LocationCodes.put("固原", 101170401);
	    LocationCodes.put("中卫", 101170501);
	    LocationCodes.put("西宁", 101150101);
	    LocationCodes.put("海东", 101150201);
	    LocationCodes.put("黄南", 101150301);
	    LocationCodes.put("海南", 101150401);
	    LocationCodes.put("果洛", 101150501);
	    LocationCodes.put("玉树", 101150601);
	    LocationCodes.put("海西", 101150701);
	    LocationCodes.put("海北", 101150801);
	    LocationCodes.put("济南", 101120101);
	    LocationCodes.put("青岛", 101120201);
	    LocationCodes.put("淄博", 101120301);
	    LocationCodes.put("德州", 101120401);
	    LocationCodes.put("烟台", 101120501);
	    LocationCodes.put("潍坊", 101120601);
	    LocationCodes.put("济宁", 101120701);
	    LocationCodes.put("泰安", 101120801);
	    LocationCodes.put("临沂", 101120901);
	    LocationCodes.put("菏泽", 101121001);
	    LocationCodes.put("滨州", 101121101);
	    LocationCodes.put("东营", 101121201);
	    LocationCodes.put("威海", 101121301);
	    LocationCodes.put("枣庄", 101121401);
	    LocationCodes.put("日照", 101121501);
	    LocationCodes.put("莱芜", 101121601);
	    LocationCodes.put("聊城", 101121701);
	    LocationCodes.put("太原", 101100101);
	    LocationCodes.put("大同", 101100201);
	    LocationCodes.put("阳泉", 101100301);
	    LocationCodes.put("晋中", 101100401);
	    LocationCodes.put("长治", 101100501);
	    LocationCodes.put("晋城", 101100601);
	    LocationCodes.put("临汾", 101100701);
	    LocationCodes.put("运城", 101100801);
	    LocationCodes.put("朔州", 101100901);
	    LocationCodes.put("忻州", 101101001);
	    LocationCodes.put("吕梁", 101101100);
	    LocationCodes.put("西安", 101110101);
	    LocationCodes.put("咸阳", 101110200);
	    LocationCodes.put("延安", 101110300);
	    LocationCodes.put("榆林", 101110401);
	    LocationCodes.put("渭南", 101110501);
	    LocationCodes.put("商洛", 101110601);
	    LocationCodes.put("安康", 101110701);
	    LocationCodes.put("汉中", 101110801);
	    LocationCodes.put("宝鸡", 101110901);
	    LocationCodes.put("铜川", 101111001);
	    LocationCodes.put("成都", 101270101);
	    LocationCodes.put("攀枝花", 101270201);
	    LocationCodes.put("自贡", 101270301);
	    LocationCodes.put("绵阳", 101270401);
	    LocationCodes.put("南充", 101270501);
	    LocationCodes.put("达州", 101270601);
	    LocationCodes.put("遂宁", 101270701);
	    LocationCodes.put("广安", 101270801);
	    LocationCodes.put("巴中", 101270901);
	    LocationCodes.put("泸州", 101271001);
	    LocationCodes.put("宜宾", 101271101);
	    LocationCodes.put("内江", 101271201);
	    LocationCodes.put("资阳", 101271301);
	    LocationCodes.put("乐山", 101271401);
	    LocationCodes.put("眉山", 101271501);
	    LocationCodes.put("凉山", 101271601);
	    LocationCodes.put("雅安", 101271701);
	    LocationCodes.put("甘孜", 101271801);
	    LocationCodes.put("阿坝", 101271901);
	    LocationCodes.put("德阳", 101272001);
	    LocationCodes.put("广元", 101272101);
	    LocationCodes.put("台北县", 101340101);
	    LocationCodes.put("高雄", 101340201);
	    LocationCodes.put("台南", 101340301);
	    LocationCodes.put("台中", 101340401);
	    LocationCodes.put("桃园", 101340501);
	    LocationCodes.put("新竹县", 101340601);
	    LocationCodes.put("宜兰", 101340701);
	    LocationCodes.put("马公", 101340801);
	    LocationCodes.put("嘉义", 101340901);
	    LocationCodes.put("花莲", 101341001);
	    LocationCodes.put("台东", 101341101);
	    LocationCodes.put("彭佳屿", 101341201);
	    LocationCodes.put("拉萨", 101140101);
	    LocationCodes.put("日喀则", 101140201);
	    LocationCodes.put("山南", 101140301);
	    LocationCodes.put("林芝", 101140401);
	    LocationCodes.put("昌都", 101140501);
	    LocationCodes.put("那曲", 101140601);
	    LocationCodes.put("阿里", 101140701);
	    LocationCodes.put("乌鲁木齐", 101130101);
	    LocationCodes.put("克拉玛依", 101130201);
	    LocationCodes.put("石河子", 101130301);
	    LocationCodes.put("昌吉", 101130401);
	    LocationCodes.put("吐鲁番", 101130501);
	    LocationCodes.put("库尔勒", 101130601);
	    LocationCodes.put("阿拉尔", 101130701);
	    LocationCodes.put("阿克苏", 101130801);
	    LocationCodes.put("喀什", 101130901);
	    LocationCodes.put("伊宁", 101131001);
	    LocationCodes.put("塔城", 101131101);
	    LocationCodes.put("哈密", 101131201);
	    LocationCodes.put("和田", 101131301);
	    LocationCodes.put("阿勒泰", 101131401);
	    LocationCodes.put("阿图什", 101131501);
	    LocationCodes.put("博乐", 1011301601);
	    LocationCodes.put("昆明", 101290101);
	    LocationCodes.put("大理", 101290201);
	    LocationCodes.put("红河", 101290301);
	    LocationCodes.put("曲靖", 101290401);
	    LocationCodes.put("保山", 101290501);
	    LocationCodes.put("文山", 101290601);
	    LocationCodes.put("玉溪", 101290701);
	    LocationCodes.put("楚雄", 101290801);
	    LocationCodes.put("普洱", 101290901);
	    LocationCodes.put("昭通", 101291001);
	    LocationCodes.put("临沧", 101291101);
	    LocationCodes.put("怒江", 101291201);
	    LocationCodes.put("中甸", 101291301);
	    LocationCodes.put("丽江", 101291401);
	    LocationCodes.put("德宏", 101291501);
	    LocationCodes.put("景洪", 101291601);
	    LocationCodes.put("杭州", 101210101);
	    LocationCodes.put("湖州", 101210201);
	    LocationCodes.put("嘉兴", 101210301);
	    LocationCodes.put("宁波", 101210401);
	    LocationCodes.put("绍兴", 101210501);
	    LocationCodes.put("台州", 101210601);
	    LocationCodes.put("温州", 101210701);
	    LocationCodes.put("丽水", 101210801);
	    LocationCodes.put("金华", 101210901);
	    LocationCodes.put("衢州", 101211001);
	    LocationCodes.put("舟山", 101211101);
	    LocationCodes.put("香港", 101320101);
		LocationCodes.put("澳门", 101330101);
		LocationCodes.put("台北", 101340101);
		LocationCodes.put("高雄", 101340201);
		LocationCodes.put("台中", 101340401);
		
		LocationNames.addAll(LocationCodes.keySet());
		
		WeatherCodes.put("晴", 0);
		WeatherCodes.put("多云", 1);
		WeatherCodes.put("阴", 2);
		WeatherCodes.put("阵雨", 3);
		WeatherCodes.put("雷阵雨", 4);
		WeatherCodes.put("雷阵雨伴有冰雹", 5);
		WeatherCodes.put("雨夹雪", 6);
		WeatherCodes.put("小雨", 7);
		WeatherCodes.put("中雨", 8);
		WeatherCodes.put("大雨", 9);
		WeatherCodes.put("暴雨", 10);
		WeatherCodes.put("大暴雨", 11);
		WeatherCodes.put("特大暴雨", 12);
		WeatherCodes.put("阵雪", 13);
		WeatherCodes.put("小雪", 14);
		WeatherCodes.put("中雪", 15);
		WeatherCodes.put("大雪", 16);
		WeatherCodes.put("暴雪", 17);
		WeatherCodes.put("雾", 18);
		WeatherCodes.put("冻雨", 19);
		WeatherCodes.put("沙尘暴", 20);
		WeatherCodes.put("小雨-中雨", 21);
		WeatherCodes.put("中雨-大雨", 22);
		WeatherCodes.put("大雨-暴雨", 23);
		WeatherCodes.put("暴雨-大暴雨", 24);
		WeatherCodes.put("大暴雨-特大暴雨", 25);
		WeatherCodes.put("小雪-中雪", 26);
		WeatherCodes.put("中雪-大雪", 27);
		WeatherCodes.put("大雪-暴雪", 28);
		WeatherCodes.put("浮尘", 29);
		WeatherCodes.put("扬沙", 30);
		WeatherCodes.put("强沙尘暴", 31);
		WeatherCodes.put("霾", 32);
		
		WeatherNames.addAll(WeatherCodes.keySet());
		
	}
	
	public static int FindLocationCode(String locationName) {
		
		int size = LocationNames.size();
		for(int i = 0; i < size; i++) {
			
			String ln = LocationNames.get(i);
			
			if(locationName.contains(ln)) {
				return LocationCodes.get(ln);
			}
			
		}
		
		return -1;
		
	}
	
	public static int FindWeatherCode(String weatherName) {
		
		return WeatherCodes.get(weatherName);
		
	}
	
}
